package com.yun.springbootsecurity.mapper;

import com.yun.springbootsecurity.pojo.Role;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

@Mapper
public interface RoleMapper {

    @Select("select * from t_role where role_id = #{roleId}")
    @Results({
            @Result(id = true, column = "role_id", property = "roleId"),
            @Result(column = "role_id", property = "rolePermissionList", many = @Many(
                    select = "com.yun.springbootsecurity.mapper.RolePermissionMapper.getRolePermissionByRoleId",
                    fetchType = FetchType.LAZY
            ))
    })
    Role selectByRoleId(String roleId);
}
